babl: initialize 'palette' babl-format member
authorMassimo Valentini <mvalentini@src.gnome.org>
Fri, 4 May 2012 17:04:03 +0000 (19:04 +0200)
committerMassimo Valentini <mvalentini@src.gnome.org>
Fri, 4 May 2012 17:04:20 +0000 (19:04 +0200)
otherwise non-palette formats could be mistakenly used as palette

babl/babl-format.c
tests/palette.c

index 0a7a840409fb64ce73f2568569b8d586dd09015c..6fc0a9c9503a8a90285c1548ae6b6bec06094c5f 100644 (file)
@@ -115,6 +115,7 @@ format_new (const char     *name,
   babl->format.visited = 0;
   babl->format.image_template = NULL;
   babl->format.format_n = 0;
+  babl->format.palette = 0;
 
   return babl;
 }
index aaf98c8e3fdcfe81969e507044ab1f770a9010a6..85192622b866852a84e1a5fddae98acd5477bef4 100644 (file)
@@ -29,6 +29,7 @@ main (int    argc,
 {
   int OK = 1;
   babl_init ();
+  OK = ! babl_format_is_palette (babl_format_n (babl_type ("double"), 3));
   if(1){
     unsigned char in[][1]   = {{        0},{          1},{          2},{15}};
     unsigned char out[][4]  = {{0,0,0,255},{127,0,0,255},{0,127,0,255},{255,255,255,255}};